home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / dinner.lwm < prev    next >
Text File  |  1993-12-13  |  7KB  |  199 lines

  1. /* Dinner Haiku Generator
  2.    from "Using ARexx on the Amiga" by Sullivan and Zamara 
  3.    Adapted By Arnie
  4.    Encrufted by Robert
  5.    Sun May 24  12:45:53 1993
  6. */
  7.  
  8. signal on error
  9. signal on syntax
  10.  
  11. call InitVocab()
  12. call random(,,time('s'))
  13.  
  14. call addlib "LWModelerARexx.port", 0
  15. Continue=1
  16. do while Continue
  17.    Continue= GetDinner()
  18.    end
  19.  
  20. say 'Exiting...'
  21.  
  22. exit
  23.  
  24.  
  25. /* GetDinner
  26.  
  27.    Generate and return a single Haiku poem which tells us where to eat(in Topeka).
  28. */
  29.  
  30. GetDinner:
  31.    /* Select a template, parse it into 3 lines, and clear output buffer. */
  32.    t = random(1,num_templates)
  33.    parse var tem.t line.1 '+' line.2 '+' line.3
  34.    out. = ''
  35.  
  36.    /* Process template lines one at a time. */
  37.    do i=1 to 3
  38.  
  39.       /* Keep going till template line exhausted. */
  40.       do while length(line.i) > 0
  41.          parse var line.i cmd 3 qual 4 line.i
  42.    
  43.          c = left(cmd, 1)
  44.          ucmd = upper(cmd)
  45.  
  46.          if v.ucmd ~= "" then do
  47.             w = word(v.ucmd, random(1, words(v.ucmd)))
  48.    
  49.             if datatype(c, 'u') then
  50.                w = upper(left(w, 1))substr(w, 2)
  51.  
  52.             upper c
  53.  
  54.             if c='V' & qual='@' then
  55.                w = add_ing(w)
  56.             else if c='N' & qual='s' then
  57.                w = pluralize(w)
  58.             else
  59.                line.i = qual || line.i
  60.  
  61.             end
  62.          else if c='/' then do
  63.             parse value cmd || qual || line.i with '/' list '/' line.i
  64.             w = word(list, random(1, words(list)))
  65.             end
  66.          else
  67.             parse value cmd || qual || line.i with w 2 line.i
  68.  
  69.          out.i = out.i || w
  70.          end
  71.       end
  72.       out.1=translate(out.1,' ','_')
  73.       out.2=translate(out.2,' ','_')
  74.       out.3=translate(out.3,' ','_')
  75.       say
  76.       say out.1  /* Redirect rx output to file */
  77.       say out.2  /* To capture Haikus to file */
  78.       say out.3  /* i.e. RX >>S:Haiku.Log Haiku.lwm  */
  79.       say
  80.    return notify(2,'!'out.1, '!'out.2, '!'out.3,'@Bad choice? Try again!')
  81.  
  82.  
  83.  
  84. InitVocab:
  85.  
  86. v. = ""
  87.  
  88. /* Restaurants, two syllables */
  89. v.j2 = "Annie's Chili's Winsteads the_Pad Denny's Vista the_Mall Mama's Tia's Arby's"
  90. v.j2 = v.j2 "Tony's Subway Robert's Wendy's Luby's Dilley's Aboud's Byrd's_Nest Casa"
  91. v.j2 = v.j2 "Grover's Hardee's Kobe Reema's Rosa's Shoney's Schlotzsky's Great_Wall"
  92.  
  93. /* Restaurants, three syllables */
  94. v.j3 = "Evergreen Steak_&_Ale Bennigans Paisano's Pizza_Chef KFC McDonald's"
  95. v.j3 = v.j3 "Burger_King McFarland's Giorgio's Don's_Steakhouse Applebee's"
  96. v.j3 = v.j3 "Por'e_Richard's Red_Lobster Taco_Bell Village_Inn Horizons"
  97.  
  98.  
  99. /*
  100. In case any of you out there are reading through this program, the above two
  101. sets of variables represents all of the restaurants open in Topeka, KS as of
  102. 5/24/93, and we just got the Denny's.  My advice to you if you are planning to
  103. visit Topeka is, first of all, don't and if you can't avoid it, then bring all
  104. of the food that you will need with you.
  105. */
  106.  
  107.  
  108. /* Dead Restaurants, two syllables */
  109. v.d2 = "Blue_Moon Thu_Lang Victor's"
  110.  
  111. /* nouns, one syllables */
  112. v.n1 = "dirt lead glass rocks mud rags mice rats cloth wire SPAM bones dust sand dung"
  113. v.n1 = v.n1 "hair grass caulk logs wood Gak shoes"
  114.  
  115. /* nouns, two syllables */
  116. v.n2 = "gerbil budgie parrot squirrel concrete badger muskrat baboon gravel pigeon"
  117. v.n2 = v.n2 "lumber dingo dry_rot spackle Drano Windex Clorox polish"
  118.  
  119. /* food, two syllables */
  120. v.f2 = "souffle salad sandwich surprise stirfry flambe pasta cobbler"
  121.  
  122. /* food verbs, one syllable */
  123. v.e1 = "walk eat drive die sink croak stop crawl bite morph spit frag fade crave"
  124. v.e1 = v.e1 "cut rent burn shop chomp pay drink eat snore writhe split"
  125.  
  126. /* food verbs, two syllables */
  127. v.e2 = "explode refuse argue decline accept endure reboot scatter"
  128. v.e2 = v.e2 "rebel retire despair wonder argue argue argue grumble"
  129. v.e2 = v.e2 "comply render shiver flatline guru argue"
  130.  
  131. /* food adjectives, two syllables */
  132. v.c2 = "empty fallen dismal crufty rabid smiling dying brain_dead "
  133. v.c2 = v.c2 "sickened stricken clueless hopeless angry flattened helpless puking"
  134.  
  135. /* food line 1 */
  136. v.b1 = "Are_we_hungry_yet? Let's_go_eat_food_now! Let's_argue_for_food!"
  137. v.b1 = v.b1 "Must_we_eat_so_soon? Dinner_time_again? Let's_go_get_poisoned!"
  138. v.b1 = v.b1 "Who_here_is_hungry? It's_that_time_again! We_want_some_good_food!"
  139.  
  140. /* food line 2, 4 syllables */
  141. v.b4 = "You_are_doomed_to We're_hungry_for Everyone_loves We'll_have_fun_at"
  142. v.b4 = v.b4 "Snarf_and_barf_at There's_fresh_food_at Free_dessert_at"
  143.  
  144. /* food line 2, 5 syllables */
  145. v.b5 = "Your_death_awaits_at Instead_of_food_try There's_free_Rolaids_at"
  146. v.b5 = v.b5 "We_love_the_food_at No_one's_been_killed_at Let's_all_go_to"
  147. V.b5 = v.b5 "Brave_NewTekkers_try 2_for_1_sale_at"
  148.  
  149. /* food line 3 */
  150. v.b6 = "Best_food_in_the_world! Who_could_ask_for_more? Topeka's_finest!"
  151. v.b6 = v.b6 "Mmmm,_a_tasty_treat! My_favorite_death. We'll_even_have_seconds."
  152. v.b6 = v.b6 "Delicious_food___-_NOT! Call_the_ambulance! Quick!_Run_for_your_lives."
  153. v.b6 = v.b6 "It's_bleedin'_demised! Bring_the_stomach_pumps."
  154.  
  155. /* Dinner Haiku templates
  156.  
  157.    The special tokens in the templates are:
  158.  
  159.    a1,n2 etc.     Part of speech, replaced randomly from corresponding list
  160.    A1,N2 etc.     Same, but with initial capital
  161.    +              Converted to linefeed
  162.    @              After verb, specifies conversion to `ing' (gerund) form
  163.    s              After noun, specifies conversion to plural form
  164.    /wordlist.../  Replaced by a word picked randomly from the list
  165.  
  166.    All other symbols in the templates are taken literally.
  167. */
  168.  
  169. tem.  = ""
  170. tem.1 = "b1 +b4 j3. +C2, we e2."
  171. tem.2 = "b1 +b5 j2. +C2, we e2."
  172. tem.3 = "b1 +j2 is rarely /fatal toxic nasty deadly lethal/! +C2, we e2."
  173. tem.4 = "b1 +b4 j3. +b6"
  174. tem.5 = "b1 +b5 j2. +b6"
  175. tem.6 = "b1 +j2 is rarely /fatal toxic nasty deadly lethal/! +C2, we e2."
  176. tem.7 = "b1 +b5 j2. +b6"
  177. tem.8 = "b1 +b4 j3. +b6"
  178. tem.9 = "Lets eat at d2. +Yes! A damn fine restaurant. +/Ack! Doh! Oops!/ Out of business."
  179. tem.10 = "b1 +b5 j2. +I'd as soon eat n1! "
  180. tem.11 = "b1 +b4 j3. +I'd rather eat n1!"
  181. tem.12 = "Let's eat at j2! +We'll have their n2 f2. +I'd as soon eat n1!"
  182. tem.13 = "Let's try j3! +We'll have their n2 f2. +I'd as soon eat n1!"
  183. tem.14 = "Let's eat at j2! +We'll have their n2 f2. +C2, we e2."
  184. tem.15 = "Let's try j3! +We'll have their n2 f2. +C2, we e2."
  185. tem.16 = "Let's eat at j2! +We'll have their n2 f2. +b6"
  186. tem.17 = "Let's try j3! +We'll have their n2 f2. +b6"
  187. tem.18 = "Unbelievably bad +for reasons you can't +even begin to imagine."
  188.  
  189. do i=1 while tem.i ~= ""
  190.    end
  191.  
  192. num_templates = i - 1
  193.  
  194. return
  195.  
  196. syntax:
  197. error:
  198.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  199.     exit